﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using RobotCtrl;
using RobotView;

namespace TestCE
{
    public partial class Form1 : Form
    {
        #region members
        private Robot robot;
        #endregion

        #region constructor & destructor
        public Form1()
        {
            InitializeComponent();

            robot = new Robot();
            robot.Drive.Power = true;

            driveView1.Drive = robot.Drive;
            runLine1.Drive = robot.Drive;
            runTurn1.Drive = robot.Drive;
            runArcLeftRight1.Drive = robot.Drive;

            consoleView1.RobotConsole = robot.RobotConsole;

            commonRunParameters1_SpeedChanged(null, EventArgs.Empty);
            commonRunParameters1_AccelerationChanged(null, EventArgs.Empty);

        }
        #endregion

        #region methods
        private void commonRunParameters1_AccelerationChanged(object sender, EventArgs e)
        {
            runLine1.Acceleration = commonRunParameters1.Acceleration;
            runTurn1.Acceleration = commonRunParameters1.Acceleration;
            runArcLeftRight1.Acceleration = commonRunParameters1.Acceleration;
        }

        private void commonRunParameters1_SpeedChanged(object sender, EventArgs e)
        {
            runLine1.Speed = commonRunParameters1.Speed;
            runTurn1.Speed = commonRunParameters1.Speed;
            runArcLeftRight1.Speed = commonRunParameters1.Speed;
        }
        #endregion
    }
}